﻿$(function () {
    $("#submit").click(function () {
        Submit();
    });
    $("#cancel").click(function () {
        location.href = "/Donate";
    });
});

function Submit() {

    $("#submit").hide();

    var input = {
        DonationID: $("#DonationID").val()
    };

    Ajax({
        url: "/Donate/ConfirmDonation",
        data: JSON.stringify(input),
        success: function (data) {
            if (data.IsValid == false) {
                ShowValidationErrors(data);
            } else if (data.IsSaved == true) {
                location.href = "/Donate/ThankYou";
            }
        },
        complete: function () {
            $("#submit").show();
        }
    });
}